import { useState, useEffect } from "react";
import { getChannelApi } from "@/apis/adminuser";

function useChannel() {
    //初始化信息
    const [channelList, setChannellist] = useState([])
    useEffect(() => {
        //标准写法
        const getChannelList = async () => {
            const res = await getChannelApi()
            setChannellist(res.data.channels)
        }
        //调用函数  
        getChannelList()
    }, [])
    return {
        channelList,
        setChannellist
    }
}

export {
    useChannel
}